package com.zenghus.v2.sqlsession;


import com.zenghus.v2.config.Configuration;
import com.zenghus.v2.executor.Executor;
import com.zenghus.v2.mapper.MapperRegistory;

import java.util.List;

public class SqlSession {
    public Configuration configuration;
    public Executor executor;

    public SqlSession(Configuration configuration, Executor executor) {
        this.configuration = configuration;
        this.executor = executor;
    }

    /**
     * getmapper
     * @param clazz
     */
    public <T> T getMapper(Class clazz){
        return (T) configuration.getMapper(clazz,this);
    }


    public <T> T selectOne(MapperRegistory.MapperDate mapperData, Object param){
        return (T) executor.query(mapperData,param);
    }
}
